package com.EAIPClub.CodeShellConnecter.controller;

import com.EAIPClub.CodeShellConnecter.service.WebSSHservice;
import com.api.POJO.CodeLab.CodeShellConnecter.WebSSHCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * @Description :
 * @Author :
 * @Date : 2021/12/19
 */
@RestController
public class OrderController {

    private WebSSHservice service;

    @Autowired
    public void setService(WebSSHservice service) {
        this.service = service;
    }

    @PostMapping ("/codeshell/order")
    public void sendCommandToSSH(@RequestBody WebSSHCommand command) throws IOException {
        service.sendOrderToSSH(command.getCommand()+"\n");
    }

}
